<template>
  <div class="goods_detail">
    <div class="top">
      <div class="left">
        <GoodsImages />
      </div>
      <div class="right">
        <GoodsName />
        <GoodsSku :goods="goods" />
      </div>
    </div>

    <!-- 详情/评论 -->
    <div class="middle">
      <Pagination :page="page" @pageChange="getList"/>
    </div>
  </div>
</template>

<script>
import GoodsImages from './components/goodsImages.vue'
import GoodsName from './components/goodsName.vue'
import GoodsSku from './components/goodsSku.vue'
import axios from 'axios'
export default {
  name: 'GoodsDetails',
  components: { GoodsImages, GoodsName, GoodsSku },
  data () {
    return {
      fullLocation: '',
      goods: {},
      page: {
        currentPage: 2,
        pageSize: 10,
        total: 110
      }
    }
  },
  mounted () {
    this.getGoodsData()
  },
  methods: {
    addressChange () {},
    getGoodsData () {
      axios({
        url: 'http://pcapi-xiaotuxian-front-devtest.itheima.net/goods?id=1143021'
      }).then((res) => {
        this.goods = res.data.result
        console.log('this.goods', this.goods)
      })
    },
    // 页码发生变化
    getList (page) {
      console.log('page', page)
      this.page.currentPage = page
    }
  }
}
</script>

<style lang="less" scoped>
.goods_detail {
  .top {
    display: flex;
    .left {
      flex: 1;
    }
    .right {
      flex: 1;

    }
  }
}
</style>
